In a virtualization technique, a plurality of virtual machines are run on a physical computer. Each virtual machine may execute an operating system (referred to as a guest OS) as if executed on independent hardware. Integrating a plurality of independent operating systems (OSs) and implementing them on one computer allows an effective use of hardware resources such as a central processing unit (CPU) and a storage.
On the other hand; the efficiency of memory use is inferior to a case where a plurality of server applications are executed on one hardware and one OS. For example, in comparing a case where two server applications of A and B are executed on one OS with a case where two independent virtual machines executes the applications A and B respectively on the one OS, each of the virtual machines has a program executable code for the OS on the memory in the latter case. Accordingly, the memory consumption of the entire of the virtual machines is increased.
Sharing the same page of the memory between virtual machines referring to identical contents may improve the efficiency of memory use in virtualization.
As a known technique to search pages, from among pages of a memory, containing identical contents and allocated to different virtual machines, there is a method in which pages for a guest OS are scanned, and pages, with an attribute of “executable” or “read-only”, that is, pages accessible by a CPU and generally containing a program executable code, are indexed by hash values of the pages. The pages containing identical contents are identified by detecting pages having the same hash value in accordance with a hash table and comparing contents of detected pages to share the memory. Such method is employed by, for example, VMware (registered trade-mark) ESX Server which is virtualization software provided by VMware, Inc. (for example, see U.S. Pat. No. 6,789,156).
As another known technique, there is a method for sharing constituent modules of an OS between a plurality of OSs executed on one computer. In the method, when a microkernel of an OS is loaded, a kernel loader allocates an object code of the microkernel in a common region that may be accessed from the plurality of OSs to manage a list of object codes accessible from the plurality of OSs and set for a page table (for example, see Japanese Laid-Open Patent Publication No. 2007-35066).
In the method of searching the identical contents from the pages allocated to the virtual machines, the page contents are basically compared to each other. Thus, as the amount of the memory installed in the hardware increases or the number of the virtual machines increases, the calculation load increases.
In sharing the memory between the virtual machines in conventional methods, all pages used by a virtual machine upon running, for example, in a case of a normal page size of 4 KB per page, 262,144 pages per GB, are accessed and calculated. Thus, as the number of the virtual machines increases or the amount of used memory increases, the amount of calculation linearly increases.
In the method for sharing the constituent modules of the OSs, the sharable pages are limited to pages for the kernel module, and the setting of sharing is performed only when the OS is initialized. Thus, the memory sharing target is limited to the microkernel module of the OS initialized when the virtual machine is started, and the applicable range of sharing is very narrow.